The present invention relates to a figure data processing apparatus and method, and more particularly to a figure data processing apparatus and method particularly suitable for drawing figures with a hidden surface removing processing and/or a transparent surface processing executed in a three-dimensional graphic display apparatus.
To express a display figure in three dimensions, a three-dimensional graphic display apparatus is conventionally provided to have a hidden surface removing function and a shading function.
As for the hidden surface removing function, there is widely used a depth buffer algorithm in which a depth value for each picture element is stored in a depth buffer so that only the frontmost or innermost picture elements can be drawn.
More specifically, as shown in FIG. 10, x- and y-coordinates data of each picture element supplied from a line segment drawing circuit 51 are supplied to a frame memory 52 and a depth buffer 53 both provided for displaying a figure. An incremental value of brightness value data calculated by a divider 54 is supplied to an adder 55. There, cumulative addition is executed to obtain brightness value data, which are supplied to the frame memory 52 through a logic product gate 56. An incremental value of depth coordinates data (hereinafter referred to as "z-coordinates value data") calculated by a divider 57 is supplied to an adder 58, in which cumulative addition is executed to obtain z-coordinates value data. In a comparator 59, the z-coordinates value data already loaded in the depth buffer 53. Only the z-coordinates value data judged to be in a predetermined relation in size with respect to the loaded value, are loaded in a depth buffer 53. A judgement result signal, representing the result judged by the comparator 59, is supplied to the logic product gate 56, to control the brightness value data applied to the frame memory 52.
Accordingly, either a maximum or a minimum value of z-coordinates value data (to be determined by conditions set for hidden surface removal) is loaded in the depth buffer 53 at all times. Only when z-coordinates value data deviating from the maximum or minimum value have been supplied, the z-coordinates value data in the depth buffer 53 can be renewed and brightness value data can be loaded in the frame memory 52. By executing the above-mentioned operations for all picture element data, figure data in which hidden surface removal has been achieved are loaded in the frame memory 52. Accordingly, based on the contents of the frame memory 52, a display device 50 can display a figure in which hidden surface removal has been made.
In the hidden surface removing function discussed above, a depth buffer 53 of great capacity is required for storing a z-coordinates value for each picture element, in addition to the frame memory 52 for storing color data for each picture element. Further, there are required the comparator 59 for comparing z-coordinates value data calculated for each picture element, with z-coordinates value data loaded in the depth buffer 53, and the logic product gate 56 for controlling a supply of brightness value data to the frame memory 52, which supply is to be finally controlled by a judgement result signal supplied from the comparator 59. Accordingly, the apparatus not only has a complicated arrangement, but also becomes expensive.
In hidden surface removal with the use of the depth buffer 53, the order in which figure data are drawn, is random regardless of the depth order. Accordingly, when the z-data of the edge of a front figure coincide with the z-data of the edge of an inner figure, there are instances where the color of the edge of the inner or front figure is overwritten by the color of the front or inner figure and the color of the inner surface which should not be displayed, is displayed. This results in deterioration in quality of the figure finally displayed.
Further, even if the apparatus is provided with the depth buffer 53 for hidden surface removal, the apparatus cannot be used for transparent surface processing according to either the Gouraud shading function or the Phong shading function as will be discussed later.
To arrive at the above-mentioned shading function, there has been employed, as a primitive method, a method in which brightness value data are also interpolated in executing the linear interpolation (Gouraud shading function). According to this method, however, a stripe is generated at the boundary between drawing figures, resulting in awkward expression of a display figure in three dimensions. In this connection, the recent trend is to employ the Phong shading function in which brightness operation is carried out based on a normal vector of a drawing figure.
According to this Phong shading processing, when a plurality of transparent surfaces exist, figure data of each transparent surface are drawn successively in the depth order after an opaque surface has been drawn. Thus, a natural expression of a display figure in three dimensions can be finally obtained.
In the Phong shading function, figure data are drawn in a predetermined order for each segment. Accordingly, when the drawing order is set such that drawing is made in a direction from an opaque surface to the frontmost transparent surface, accurate brightness value data can be calculated by merely drawing each segment successively.
In an intelligent three-dimensional graphic display apparatus, however, even though the drawing order is previously set such that segments are drawn in a direction from the innermost side to the frontmost side, it is not ensured at all that segments are actually drawn in this previously set order.
More specifically, even though transparent surfaces overlap one another and the drawing order has been previously set such that drawing is made in a direction from the innermost side to the frontmost side, i.e., from an opaque surface 41 to a transparent surface 43 through a transparent surface 42 as shown in FIG. 11, the actual drawing order is not always identical with the previously set depth order if the drawing figures are rotated. It is noted that the term "depth order" hereinafter means a drawing order in which drawing is made from the innermost side to the frontmost side.
It is now supposed that the opaque surface 41 has a brightness value I1, the transparent surfaces 42 and 43 have brightness values I2 and I3, respectively, and transmissivities e2 and e3, respectively, and the correct brightness value to be visible to the eyes is I. In FIG. 11, the following equation is established: EQU I=I3+e3(I2+e2I1)
When the figures are drawn in depth order, the opaque surface 41 is drawn first, and then, the transparent surfaces 42 and 43 are drawn in this order. Therefore, it is just required to obtain a new brightness value from a brightness value previously operated and loaded in a memory and a brightness value of a surface to be drawn, and to load the new brightness value thus obtained in the memory, each time each surface is drawn.
It is now supposed that the brightness value loaded in the memory is IM and the transmissivity el of the opaque surface 41 is equal to 0. By repeating the same operation (IM=Ii+ei IM) as shown in the following, the IM finally becomes equal to the correct brightness value I: EQU IM=I1+e1IM EQU IM=I2+e2IM EQU IM=I3+e3IM
However, when the surfaces are not drawn in the depth order, for example when the opaque surface 41 is drawn first, and then transparent surfaces 43 and 42 are drawn in this order, the correct brightness value cannot be obtained by repeating the same processing, unlike the case where the surfaces are drawn in the depth order, in that the correct brightness value I is obtained according to the equation of I=I3+e3 (I2+e2I1). That is, when operations are made in the following order: EQU IM=I1+e1IM, EQU IM=I3+e3IM,
and EQU IM=I2+e2IM.
The final brightness value IM is obtained according to the following equation: EQU IM=I2+e2 (I3+e3I1).
Accordingly, the IM thus obtained is not identical with the correct brightness value I obtained according to the following equation: EQU I=I3+e3 (I2+e2I1).
Accordingly, if it is not certain that the drawing order is identical with the depth order, it is required to provide depth buffers of which the number is equal to the number of overlaps of transparent surfaces, and to load z-coordinates values for all picture elements belonging to all surfaces in these depth buffers, after which the order in which brightness values are operated, should be determined based on the z-coordinates values loaded for all picture elements.
It has been required to provide great-capacity memories specially designed for holding brightness value and transmissivity data for each surface, and the same number of such memories are required as the number of surface overlaps, resulting in complicated arrangements and increased cost. Further, even though as many specially designed memories as the number of transparent surfaces may be provided, there are instances where the same surfaces do or do not overlap each other dependent on their coordinate transformation, as in the transparent surfaces shown in FIG. 11. If the surfaces overlap each other, the transparent surfaces should be divided in order to eliminate surface overlap. That is, the above-mentioned specially designed memories need to have a considerable redundancy, and such division required a complicated processing.
Further, the processing can be executed for only overlapping transparent surfaces of which the number is determined by the number of memories. Thus, great extensibility cannot be expected and efficient utilization of memory is reduced.
In order to overcome the above-mentioned problems it is considered to provide a software program for depth directional sorting processing in which all transparent surfaces are rearranged in the depth direction (hereinafter referred to as Z-sorting processing). However, the operation load becomes great, requiring a long period of time for the Z-sorting processing. Thus, the time required for the Phong shading is disadvantageously lengthened.